home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / v8n03.arc / TSO.C < prev    next >
C/C++ Source or Header  |  1989-01-18  |  2KB  |  67 lines

  1. /* TSO.C: This program is a very simple example of how to log on to
  2.  * a TSO session using the HLLAPI programming interface. This
  3.  * program does no checking for any error conditions which
  4.  * might occur during the signon process. */
  5.  
  6. /* EXTERNAL DECLARATIONS SECTION */
  7. /* Entry point for the Language Interface Module
  8.    (LIM) where the HLLAPI commands are processed */
  9.  
  10. externapilim();
  11.  
  12. /* GLOBAL DATA SECTION */
  13. charbuf[BUFSIZE];
  14. intlen, ps_rc, func;
  15.  
  16. main() {
  17.     doconps('A');    /* Connect Presentation Space on session 'A' */
  18.     doskey("1 TSOID@E");/* Enter TSO Logon ID */
  19.     dopause(40);    /* Wait for 20 secs for host to BIND session */
  20.     doskey("PASSWORD@E"); /* Enter Password */
  21.     dopause(30);    /* Wait 15 secs for host to display READY prompt */
  22.     doskey("LOGOFF@E");    /* Logoff of TSO Session */
  23.     dopause(30);    /* Wait for 15 secs for host to UNBIND session */
  24.     dodconps();        /* Disconnect Presentation Space */
  25. }
  26.  
  27. /***Connect Presentation Space  (Function 1)***/
  28. doconps(session)
  29.   charsession;
  30. {
  31.     func = ACONNECT;
  32.     len = 1;
  33.     buf = session;
  34.     buf[len] = '\0';
  35.     invoke();
  36. }
  37.  
  38. /***Disconnect Presentation Space (Function 2)***/
  39. dodconps() {
  40.     func = ADISCONN;
  41.     invoke();
  42. }
  43.  
  44. /***Send Key (Function 3)***/doskey(strg)
  45.   char *strg;
  46. {
  47.     len = strlen(strg);
  48.     strcpy(buf, strg);
  49.     buf[len] = '\0';
  50.     func = ASENDKEY;
  51.     invoke();
  52. }
  53.  
  54. /***Pause (Function 18)***/
  55. dopause(time)
  56.   inttime;
  57. {
  58.     len = time;
  59.     func = APAUSE;
  60.     invoke();
  61. }
  62.  
  63. /***Invoke:Calls the Language Interface Module (LIM)'s main routine.**/
  64. invoke() {
  65.     return( apilim(&func, buf, &len, &ps_rc) );
  66. }
  67.